﻿
; 定制一套XPLEE专用的CapsLock辅助插件
; (此方案弃用，完整性不如capslock+项目)
; ================================================

; ----------------------环境配置-------------------------
; 托盘区图标
IfExist, caps.ico
    Menu, Tray, Icon, caps.ico, , 1

SetStoreCapslockMode, Off      ; send后不改变caps键的状态
Process Priority,,High         ; 优先级高
SetCapsLockState AlwaysOff

; 切换大小写重映射
Capslock & Space::
Try{
    If GetKeyState("CapsLock", "T") = 1
        SetCapsLockState AlwaysOff
    Else 
        SetCapsLockState AlwaysOn
}
Return

; ----------------------右手编辑区-------------------------
; 四个方向
Capslock & h::
    Send, {Blind}{Left DownTemp}
Try{
}
Return
Capslock & h up:: 
Try{
    Send, {Blind}{Left Up}
}
Return
Capslock & j:: 
Try{
    Send, {Blind}{Down DownTemp}
}
Return
Capslock & j up:: 
Try{
    Send, {Blind}{Down Up}
}
Return
Capslock & k:: 
Try{
    Send, {Blind}{Up DownTemp}
}
Return
Capslock & k up:: 
Try{
    Send, {Blind}{Up Up}
}
Return
Capslock & l:: 
Try{
    Send, {Blind}{Right DownTemp}
}
Return
Capslock & l up:: 
Try{
    Send, {Blind}{Right Up}
}
Return

; 行(页)首末及翻页
Capslock & y:: 
Try{
    If GetKeyState("Alt", "P")
        SendInput, ^{Home}
    Else
        SendInput, {Home}
}
Return
Capslock & o:: 
Try{
    If GetKeyState("Alt", "P")
        SendInput, ^{End}
    Else
        SendInput, {End}
}
Return
Capslock & u:: 
Try{
    SendInput, {PgUp}
}
Return
Capslock & i:: 
Try{
    SendInput, {PgDn}
}
Return


; 与下行交换和连接下行
;Capslock & n::  send, {End}{Delete}
Capslock & m::
Try{
    SendInput, {End}{Delete}
}
Return

; 下建新行和删除整行
Capslock & Enter::
Try{
    SendInput, {End}{Enter}
}
Return
Capslock & BackSpace:: 
Try{
    SendInput, {End}{Shift Down}{Home}{Shift Up}{BackSpace}
}
Return

; ----------------------左手右侧编辑区-------------------------
; 前删及回车及插入
Capslock & t:: 
Try{
    SendInput, {Delete}
}
Return
Capslock & g:: 
Try{
    SendInput, {Enter}
}
Return
;Capslock & b:: SendInput, {Enter}

; ----------------------左手鼠标区-------------------------
; 四个方向移动
Mouse_Move(x, y){
    MouseMove, % x, % y, 0, R
    Return
}
Capslock & w::
Try{
    Mouse_Move(0, -45)
}
Return
Capslock & s:: 
Try{
    Mouse_Move(0, 45)
}
Return
Capslock & a:: 
Try{
    Mouse_Move(-45, 0)
}
Return
Capslock & d::
Try{
    Mouse_Move(45, 0)
}
Return

; 左右键
Capslock & e:: 
Try{
    MouseClick, left
}
Return
Capslock & q:: 
Try{
    MouseClick, right
}
Return

; 滚轮上下
Capslock & r::
Try{
    MouseClick, WheelUp,,,2
}
Return
Capslock & f:: 
Try{
    MouseClick, WheelDown,,,2
}
Return

; ----------------------左手粘贴区-------------------------
; 整行剪切/复制与粘贴
Capslock & z:: 
Try{
    SendInput, ^{z}
}
Return
Capslock & x:: 
Try{
    SendInput, {Home}+{End}^{x}
}
Return
Capslock & c:: 
Try{
    SendInput, {Home}+{End}^{Insert}{End}
}
Return
Capslock & v:: 
Try{
    SendInput, ^{v}
}
Return

; ----------------------F区-------------------------
Capslock & 1:: 
Try{
    Send, {F1}
}
Return
Capslock & 2:: 
Try{
    Send, {F2}
}
Return
Capslock & 3:: 
Try{
    Send, {F3}
}
Return
Capslock & 4:: 
Try{
    Send, {F4}
}
Return
Capslock & 5:: 
Try{
    Send, {F5}
}
Return
Capslock & 6:: 
Try{
    Send, {F6}
}
Return
Capslock & 7:: 
Try{
    Send, {F7}
}
Return
Capslock & 8:: 
Try{
    Send, {F8}
}
Return
Capslock & 9:: 
Try{
    Send, {F9}
}
Return
Capslock & 0::
Try{
    Send, {F10}
}
Return
Capslock & -::
Try{
    Send, {F11}
}
Return
Capslock & =:: 
Try{
    Send, {F12}
}
Return
